
<?php


 /**
  * Employee Value Object.
  * This class is value object representing database table Employee
  * This class is intented to be used together with associated Dao object.
  */


class Employee {

    /** 
     * Persistent Instance variables. This data is directly 
     * mapped to the columns of database table.
     */
    var $EmpID;
    var $LastName;
    var $FirstName;
    var $LoginID;
    var $Password;
    var $Role;
    var $isDeleted;



    /** 
     * Constructors.
     * The first one takes no arguments and provides the most simple
     * way to create object instance. The another one takes one
     * argument, which is the primary key of the corresponding table.
     */

    function Employee () {

    }

    /* function Employee ($EmpIDIn) {

          $this->EmpID = $EmpIDIn;

    } */

    function getIsDeleted() {
        return $this->isDeleted;
    }

    function setIsDeleted($isDeleted) {
        $this->isDeleted = $isDeleted;
    }


    /** 
     * Get- and Set-methods for persistent variables. The default
     * behaviour does not make any checks against malformed data,
     * so these might require some manual additions.
     */

    function getEmpID() {
          return $this->EmpID;
    }
    function setEmpID($EmpIDIn) {
          $this->EmpID = $EmpIDIn;
    }

    function getLastName() {
          return $this->LastName;
    }
    function setLastName($LastNameIn) {
          $this->LastName = $LastNameIn;
    }

    function getFirstName() {
          return $this->FirstName;
    }
    function setFirstName($FirstNameIn) {
          $this->FirstName = $FirstNameIn;
    }

    function getLoginID() {
          return $this->LoginID;
    }
    function setLoginID($LoginIDIn) {
          $this->LoginID = $LoginIDIn;
    }

    function getPassword() {
          return $this->Password;
    }
    function setPassword($PasswordIn) {
          $this->Password = $PasswordIn;
    }

    function getRole() {
          return $this->Role;
    }
    function setRole($RoleIn) {
          $this->Role = $RoleIn;
    }



    /** 
     * setAll allows to set all persistent variables in one method call.
     * This is useful, when all data is available and it is needed to 
     * set the initial state of this object. Note that this method will
     * directly modify instance variales, without going trough the 
     * individual set-methods.
     */

    function setAll($EmpIDIn,
          $LastNameIn,
          $FirstNameIn,
          $LoginIDIn,
          $PasswordIn,
          $RoleIn) {
          $this->EmpID = $EmpIDIn;
          $this->LastName = $LastNameIn;
          $this->FirstName = $FirstNameIn;
          $this->LoginID = $LoginIDIn;
          $this->Password = $PasswordIn;
          $this->Role = $RoleIn;
    }


    /** 
     * hasEqualMapping-method will compare two Employee instances
     * and return true if they contain same values in all persistent instance 
     * variables. If hasEqualMapping returns true, it does not mean the objects
     * are the same instance. However it does mean that in that moment, they 
     * are mapped to the same row in database.
     */
    function hasEqualMapping($valueObject) {

          if ($valueObject->getEmpID() != $this->EmpID) {
                    return(false);
          }
          if ($valueObject->getLastName() != $this->LastName) {
                    return(false);
          }
          if ($valueObject->getFirstName() != $this->FirstName) {
                    return(false);
          }
          if ($valueObject->getLoginID() != $this->LoginID) {
                    return(false);
          }
          if ($valueObject->getPassword() != $this->Password) {
                    return(false);
          }
          if ($valueObject->getRole() != $this->Role) {
                    return(false);
          }

          return true;
    }



    /**
     * toString will return String object representing the state of this 
     * valueObject. This is useful during application development, and 
     * possibly when application is writing object states in textlog.
     */
    function toString() {

        $out = $out."\nclass Employee, mapping to table Employee\n";
        $out = $out."Persistent attributes: \n"; 
        $out = $out."EmpID = ".$this->EmpID."\n"; 
        $out = $out."LastName = ".$this->LastName."\n"; 
        $out = $out."FirstName = ".$this->FirstName."\n"; 
        $out = $out."LoginID = ".$this->LoginID."\n"; 
        $out = $out."Password = ".$this->Password."\n"; 
        $out = $out."Role = ".$this->Role."\n";
        $out = $out."isDeleted = ".$this->isDeleted."\n";
        return $out;
    }


    /**
     * Clone will return identical deep copy of this valueObject.
     *Here, the retuned cloned object will also have all its attributes cloned.
     */
    function clone1() {
        $cloned = new Employee();

        $cloned->setEmpID($this->EmpID); 
        $cloned->setLastName($this->LastName); 
        $cloned->setFirstName($this->FirstName); 
        $cloned->setLoginID($this->LoginID); 
        $cloned->setPassword($this->Password); 
        $cloned->setRole($this->Role); 

        $cloned->setIsDeleted($this->isDeleted);
        return $cloned;
    }

}

?>
